﻿using RepositoryFramework.Validators;
using AutoMapper;
using Portal.Logic.Validators;

namespace Portal.Logic.Bootstraper
{
	public class LogicAutoMapper : Profile
	{
		protected override void Configure()
		{
			CreateMap<FluentValidation.Results.ValidationResult, ValidationResult>()
			.ForMember(dest => dest.Errors, opt => opt.MapFrom(m => m.Errors));

			CreateMap<FluentValidation.Results.ValidationFailure, ValidationError>()
				.ForMember(dest => dest.Message, opt => opt.MapFrom(m => m.ErrorMessage));
		}
	}
}